<template>
  <div class="zw-breadcrumb">
    <el-breadcrumb>
      <template v-for="(item, index) in breadList" :key="item.path">
        <el-breadcrumb-item v-if="item.name && item.name != 'root'" :to="index === 3 ? item.path : ''"> {{ item.name }}</el-breadcrumb-item>
      </template>
    </el-breadcrumb>
  </div>
</template>

<script lang="ts" setup>
  import { ref, watch } from 'vue'
  import router from '@/router'

  let breadList: any = ref()

  watch(router.currentRoute, (val) => {
    breadList.value = val.matched
  })
</script>

<style lang="scss" scoped>
  .zw-breadcrumb {
    display: flex;
    align-items: center;
    width: 100%;
    height: 60px;
    background-color: #fff;

    .el-breadcrumb {
      padding-left: 16px;
    }
  }
</style>
